import request from '@/utils/request'

// 获取系统配置列表
export function getSystemConfigList(params = {}) {
  return request({
    url: '/system/configs',
    method: 'get',
    params
  })
}

// 获取系统配置详情
export function getSystemConfig(id) {
  return request({
    url: `/system/configs/${id}`,
    method: 'get'
  })
}

// 新增系统配置
export function addSystemConfig(data) {
  return request({
    url: '/system/configs',
    method: 'post',
    data: {
      key: data.key,
      value: data.value,
      description: data.description
    }
  })
}

// 更新系统配置
export function updateSystemConfig(id, data) {
  return request({
    url: `/system/configs/${id}`,
    method: 'put',
    data: {
      value: data.value,
      description: data.description
    }
  })
}

// 删除系统配置
export function deleteSystemConfig(id) {
  return request({
    url: `/system/configs/${id}`,
    method: 'delete'
  })
} 